package online.foxnull2.foxmall.product.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import online.foxnull2.common.valid.InsertGroup;
import online.foxnull2.common.valid.UpdateGroup;
import org.hibernate.validator.constraints.URL;

import javax.validation.constraints.*;
import java.io.Serializable;

/**
 * 品牌
 *
 * @author foxnull2
 */
@Data
@TableName("pms_brand")
public class BrandEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 品牌id
     */
    @NotNull(groups = UpdateGroup.class)
    @Null(groups = InsertGroup.class)
    @TableId
    private Long brandId;
    /**
     * 品牌名
     */
    @NotBlank(groups = InsertGroup.class)
    private String name;
    /**
     * 品牌logo地址
     */
    @NotEmpty(groups = InsertGroup.class)
    @URL(groups = {UpdateGroup.class, InsertGroup.class})
    private String logo;
    /**
     * 介绍
     */
    private String descript;
    /**
     * 显示状态[0-不显示；1-显示]
     */
    @NotNull(groups = InsertGroup.class)
    @Min(value = 0, groups = {UpdateGroup.class, InsertGroup.class})
    @Max(value = 1, groups = {UpdateGroup.class, InsertGroup.class})
    private Integer showStatus;
    /**
     * 检索首字母
     */
    @NotEmpty(groups = InsertGroup.class)
    @Pattern(regexp = "^[a-zA-Z]$", groups = {UpdateGroup.class, InsertGroup.class})
    private String firstLetter;
    /**
     * 排序
     */
    @NotNull(groups = InsertGroup.class)
    @Min(value = 0, groups = {UpdateGroup.class, InsertGroup.class})
    private Integer sort;

}
